﻿#ifndef FACECOLLECT_H
#define FACECOLLECT_H

#include <QDialog>
#include <opencv2/opencv.hpp>
#include <opencv2/face.hpp>
#include <QLabel>
#include <QTimerEvent>

#include <QSqlDatabase>
#include <QSqlQuery>
#include <QSqlError>
#include <QDebug>
#include <QSqlTableModel>
#include "faceproject.h"

using namespace  cv;
using namespace  cv::face;

namespace Ui {
class faceCollect;
}

class faceCollect : public QDialog
{
    Q_OBJECT

public:
    explicit faceCollect(QWidget *parent = nullptr);
    ~faceCollect();
    void timerEvent(QTimerEvent* e);

private slots:
    void on_collectbt_clicked();

    void on_trainbt_clicked();

    void on_pushButton_clicked();

private:
    Ui::faceCollect *ui;
    Mat face;//保存人脸
    VideoCapture cap;
    CascadeClassifier cascade;//定义分类器-检测人脸
    int timerid;
    std::vector<Mat> tranImages; //训练数据
    std::vector<int> tranLabels;  //训练标签
    QLabel *facelabel[3];
    int count;
    QSqlTableModel *model;


};

#endif // FACECOLLECT_H
